#include <gui/chippage_screen/ChipPageView.hpp>

ChipPageView::ChipPageView()
{

}

void ChipPageView::setupScreen()
{
    ChipPageViewBase::setupScreen();
}

void ChipPageView::tearDownScreen()
{
    ChipPageViewBase::tearDownScreen();
}
//更新Chip信息
void ChipPageView::updateChipInfor(uint16_t newChipTempVal, uint16_t newVrefVal, uint16_t newVbatVal)
{
		//更新芯片内部参数
		Unicode::snprintf(textChipTempBuffer, TEXTCHIPTEMP_SIZE, "%02d",newChipTempVal);
	  textChipTemp.invalidate();
		//更新芯片内部参数
		Unicode::snprintf(textChipVrefBuffer1, TEXTCHIPVREFBUFFER1_SIZE, "%d",((newVrefVal)*3300/4095)/1000);
		Unicode::snprintf(textChipVrefBuffer2, TEXTCHIPVREFBUFFER2_SIZE, "%02d", ((newVrefVal)*3300/4095)%1000);
	  textChipVref.invalidate();
		//更新芯片内部参数
		Unicode::snprintf(textChipVbatBuffer1, TEXTCHIPVBATBUFFER1_SIZE, "%d",((newVbatVal)*4*3300/4095)/1000);
		Unicode::snprintf(textChipVbatBuffer2, TEXTCHIPVBATBUFFER2_SIZE, "%02d", ((newVbatVal)*4*3300/4095)%1000);
	  textChipVbat.invalidate();
}
//页面跳转
void ChipPageView::ChipPageChange(uint8_t newFiveKeyFunc)
{
		handleKeyEvent(newFiveKeyFunc);
}